import 'package:url_launcher/url_launcher.dart';

class LaunchUtil {
  static bool isInstallWeixin = false;
  static bool isInstallAlipay = false;

  static initCanLaunch() {
    if (!isInstallWeixin) {
      isCanLaunch("weixin://").then((v) {
        LaunchUtil.isInstallWeixin = v;
      });
    }
    if (!isInstallAlipay) {
      isCanLaunch("alipay://").then((v) {
        LaunchUtil.isInstallAlipay = v;
      });
    }
    if (!isInstallAlipay) {
      isCanLaunch("alipays://").then((v) {
        LaunchUtil.isInstallAlipay = v;
      });
    }
  }

  static Future<bool> isCanLaunch(String url) async {
    return await canLaunch(url);
  }
}
